﻿package mortal.game.view.combinedServer.gift
{
    import com.mui.controls.*;
    import extend.language.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.combinedServer.data.*;
    import mortal.game.view.common.*;
    import mortal.game.view.copy.GroupTowerCopy.data.*;
    import mortal.game.view.rebate.item.*;

    public class CombinedSerGifts extends GSprite
    {
        protected var _mbg:GImageBitmap;
        protected var _tipTxt:GTextFiled;
        protected var _giftList:CellsGridSprite;
        protected var _timeTxt:GTextFiled;

        public function CombinedSerGifts()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._mbg = UIFactory.gImageBitmap(ImagesConst.CombinedSerGiftBg, 0, 0, this);
            this._tipTxt = UIFactory.gTextField("1.合服期间每", 125, 235, 511, 90, this, GlobalStyle.textFormatChen.setSize(13));
            this._tipTxt.multiline = true;
            this._tipTxt.wordWrap = true;
            this._giftList = UIFactory.getUICompoment(CellsGridSprite);
            this._giftList.colNum = 6;
            this._giftList.vCellWid = 80;
            this._giftList.hCellWid = 100;
            this._giftList.genCellFun = this.genItem;
            this._giftList.genCells(6);
            this._giftList.x = 117;
            this._giftList.y = 387;
            this.addChild(this._giftList);
            this._timeTxt = UIFactory.gTextField("2015年", 379, 121, 300, 20, this);
            this.updateRuleAndTime();
            this.updateGift();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._mbg = null;
            this._tipTxt = null;
            this._giftList = null;
            this._timeTxt = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function genItem() : RebateItem
        {
            var _loc_1:* = UIFactory.getUICompoment(RebateItem);
            return _loc_1;
        }// end function

        private function updateInfo() : void
        {
            this.updateGift();
            return;
        }// end function

        private function updateGift() : void
        {
            var _loc_1:* = CombinedSerUtil.giftCode;
            var _loc_2:* = new ItemData(_loc_1);
            RewardCfgUtil.updateRwListByGiftCode(_loc_1, this._giftList, this._giftList.colNum, 36, 615, 10);
            return;
        }// end function

        private function updateRuleAndTime() : void
        {
            this._timeTxt.text = "" + CombinedSerUtil.getOpenTimeStr();
            var _loc_1:* = GlobalStyle.textFormatChen.setSize(13);
            _loc_1.leading = 10;
            this._tipTxt.defaultTextFormat = _loc_1;
            this._tipTxt.htmlText = Language.getString(71378);
            return;
        }// end function

    }
}
